<?php
ob_start();
session_start();
?>

<html>
<head>
</head>
<body>
<div align="center">

<?php
include ("connect.php");
$dbname = 'Transportation';
mysql_select_db($dbname);

$page_title = "Abu Dhabi Transportation Web Site - Routes passing through $_POST[mydropdown1]";
$leftMenu = array
	(
		"Home" => "index.php",
		"Routes" => "routes.php",
		"Schedule" => "Schedule.php",
		"Stops" => "Stops.php",
		"How To Go There" => "#"
	);

//$content = "The Bus Schdule at $_POST[mydropdown1] Bus Stop is:";

$q = "SELECT DISTINCT busstoprel.busid, busroutes.busname
FROM busstops, busstoprel, busroutes
WHERE busstops.name = '$_POST[mydropdown1]' AND busstops.id = busstoprel.stopid
AND busstoprel.busid = busroutes.busid
ORDER BY 1";
$result = mysql_query($q);

$content .= '<table class = "data">';

$content .= "<caption>Bus Routes Passing Through $_POST[mydropdown1] </caption>";

$content .= "<tr>
    <th>Bus Number</th>
    <th>Bus Name</th>
  </tr>";

$counter = 0;
while ($row = mysql_fetch_array($result)) 
{
	if($counter%2 == 0)
	{
		$content .= "<tr>
	    <td class='spec'>$row[busid]</td>
	    <td class='specalt'>$row[busname]</td>
	  	</tr>";
	}
	else
	{
		$content .= "<tr>
	    <td class='spec'>$row[busid]</td>
	    <td class='specalt'>$row[busname]</td>
	  	</tr>";
	}
	$counter++; 
}
$content .= '</table>';

include("default_layout.php");
?>

</div>
</body>
</html>